import {
  Component,
  OnInit,
  ElementRef,
  AfterContentInit,
  Renderer2
} from '@angular/core';
import { MainNavService } from './main-nav.service';

@Component({
  selector: 'app-root',
  templateUrl: './app.component.html',
  styleUrls: [
    './app.component.less'
  ]
})
export class AppComponent implements OnInit, AfterContentInit {
  get hiddenNavBar() {
    return this.mainNavServe.showMainNav;
  }
  get mainNav() {
    return this.mainNavServe.getMainNavConfig();
  }
  constructor(
    private mainNavServe: MainNavService,
    private el: ElementRef,
    private randerer: Renderer2
  ) {}
  ngOnInit() {
  }

  ngAfterContentInit () {
    this.setContentHeight();
  }
  // 设置容器高度
  setContentHeight() {
    const appEle: HTMLElement = document.body.querySelector('#app');
    const h = document.documentElement.clientHeight + 'px';
    this.randerer.setStyle(appEle, 'height', h);
  }
}
